import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import path from "path";

export default defineConfig({
    css: {
        preprocessorOptions: {
            less: {
                javascriptEnabled: true,
            },
        },
    },
    resolve: {
        alias: {
            // 导入文件夹别名
            "@": path.resolve(__dirname, "./src"),
        },
    },
    plugins: [vue(), vueJsx({})],
    server: {
        port: 3030,
        host: "0.0.0.0",
        proxy: {
            "/api": {
                // target: "http://api.7xiaxia.com",
                target: "http://127.0.0.1:7001",
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ""),
            },
        },
    },
});
